//
//  ZFLoginConfig.m
//  HappilyLoan
//
//  Created by zainishenbian on 2017/3/22.
//  Copyright © 2017年 zongqingxiangqian. All rights reserved.
//

#import "ZFLoginConfig.h"
#import "AppDelegate.h"
#import "ZFHeader.h"

@implementation ZFLoginConfig

//判断是否是第一次进入App
+ (BOOL)judgeIsFirstEnterApp;
{
    AppDelegate *appdelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    return appdelegate.isFirstEnterApp;
}
//判断是否登录
+ (BOOL)isLogined
{
    if ([ZFPulicAPI getUserid].length > 0) {
        
        return YES;
    }
    return NO;
}
//判断手机号
+ (BOOL)isValidatePhone:(NSString *)phoneNumber
{
    NSString *phoneRegex = @"1[3|4|5|7|8|][0-9]{9}";
    NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
    return [phoneTest evaluateWithObject:phoneNumber];
}
//用户密码判断
+ (BOOL)isValidateUserPsw:(NSString *)userPsw
{
    NSString *pattern = @"^[a-zA-Z0-9]{6,16}+$";
    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", pattern];
    BOOL isMatch = [pred evaluateWithObject:userPsw];
    NSLog(@"%d",isMatch);
    return isMatch;
}
//获得登录界面
+ (ZFLoginViewController *)getLoginVC1;
{
    UIStoryboard *loginBoard = [UIStoryboard storyboardWithName:@"Login" bundle:[NSBundle mainBundle]];
    ZFLoginViewController *VC = [loginBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
    return VC;
}

//获得storyBoard中的登录界面(navLoginVC)
+ (ZFLoginViewController  *)getLoginVC2;
{
    UIStoryboard *loginBoard = [UIStoryboard storyboardWithName:@"Login" bundle:[NSBundle mainBundle]];
    ZFLoginViewController *VC = [loginBoard instantiateViewControllerWithIdentifier:@"LoginNav"];
    return VC;

}
//给selectedTabbarItem赋值
//+ (void)seleectTabbarItem:(NSInteger)tabbarItem;
//{
//    AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
//    delegate.selectedTabbarItem = tabbarItem;
//}
//
////获得选中的tabbarItem
//+ (NSInteger)getSelectedTabbarItem
//{
//    AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
//    return delegate.selectedTabbarItem;
//}

@end
